package com.learn.project2.controller.admin;

import com.learn.project2.model.vo.admin.stat.StatGoodsVO;
import com.learn.project2.model.vo.admin.stat.StatOrderVO;
import com.learn.project2.model.vo.admin.stat.StatUserVO;
import com.learn.project2.service.admin.stat.StatService;
import com.learn.project2.utils.Result;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 尹圣淼
 * @Date: 2022/1/6 22:17
 */
@RestController
@RequestMapping("admin/stat")
public class StatController {
    /**
     * @description: 75.用户统计 admin/stat/user
     * @param:
     * @return:
     * @author 尹圣淼
     * @date: 2022-01-06 22:17
     */
    @Autowired
    StatService statService;
    @RequiresPermissions(value = "admin:stat:user")
    @RequestMapping(value = "user",method = RequestMethod.GET)
    public Result user() {
        // 查market_user 这个表。
        StatUserVO statUserVO = statService.userShow();
        return Result.ok(statUserVO);
    }

    /**
     * @description: 76.订单统计 admin/stat/order
     * @param:
     * @return:
     * @author 尹圣淼
     * @date: 2022-01-06 22:18
     */
    @RequiresPermissions(value = "admin:stat:order")
    @RequestMapping(value = "order",method = RequestMethod.GET)
    public Result order() {
        // 查market_order 这个表。
        StatOrderVO statOrderVO = statService.orderShow();
        return Result.ok(statOrderVO);
    }

    /**
     * @description: 77.商品统计 admin/stat/goods
     * @param:
     * @return:
     * @author 尹圣淼
     * @date: 2022-01-06 22:19
     */
    @RequiresPermissions(value = "admin:stat:goods")
    @RequestMapping(value = "goods",method = RequestMethod.GET)
    public Result goods() {
        // 查market_order_goods这个表。
        StatGoodsVO statGoodsVO = statService.goodsShow();
        return Result.ok(statGoodsVO);
    }
}
